import { createRouter, createWebHistory } from 'vue-router';
import Home from '../view/UserHome.vue'; 
import Login from '../view/Login.vue'; 
import Contact from '../view/Contact.vue';
import About from '../view/About.vue';
import UserHome from '../view/UserHome.vue';
import AdminHome from '../view/AdminHome.vue';
import Register from '../view/Register.vue';
import Usertable from '../view/Usertable.vue';
import UserInfotable from '../view/UserInfotable.vue';
import BasicInfo from '../view/BasicInfo.vue';
import PasswordChange from '../view/PasswordChange.vue';
import InsertTicket from '../view/InsertTicket.vue';
import NewIncident from '../view/NewIncident.vue';
import NewRequest from '../view/NewRequest.vue';
import IncidentOverview from '../view/IncidentOverview.vue';
import IncidentDetail from '../view/IncidentDetail.vue';
import RequestOverview from '../view/RequestOverview.vue';
import RequestDetail from '../view/RequestDetail.vue';
import RequestDetailforAtoMe from '../view/RequestDetailforAtoMe.vue';
import RequestDetailforObyMe from '../view/RequestDetailforObyMe.vue';
import RequestDetailforPickUp from '../view/RequestDetailforPickUp.vue';
import IncidentOpenedByMe from '../view/IncidentOpenedByMe.vue';
import IncidentAssignedToMe from '../view/IncidentAssignedToMe.vue';
import RequestOpenedByMe from '../view/RequestOpenedByMe.vue';
import RequestAssignedToMe from '../view/RequestAssignedToMe.vue';
import IncidentPickUp from '../view/IncidentPickUp.vue';
import RequestPickUp from '../view/RequestPickUp.vue';
import IncidentCommentTable from '../view/IncidentCommentTable.vue';
import RequestCommentTable from '../view/RequestCommentTable.vue';
import IncidentReportView from '../view/IncidentReportView.vue';
import RequestReportView from '../view/RequestReportView.vue';
import IncidentDecisionTree from '../view/IncidentDecisionTree.vue';
import IncidentDetailfortree from '../view/IncidentDetailfortree.vue';
import IncidentDetailforAtoMe from '../view/IncidentDetailforAtoMe.vue';
import IncidentDetailforObyMe from '../view/IncidentDetailforObyMe.vue';
import IncidentDetailforPickUp from '../view/IncidentDetailforPickUp.vue';

const routes = [
  {
    path: '/',
    name: 'Login', // 将登录页设置为默认路由
    component: Login
  },
  {
    path: '/UserHome',
    name: 'UserHome',
    component: UserHome
  },
  {
    path: '/AdminHome',
    name: 'AdminHome',
    component: AdminHome,
    meta: { keepAlive: true }
  },
  {
    path: '/about',
    name: 'About',
    component: About
  },
  {
    path: '/contact',
    name: 'Contact',
    component: Contact
  },
  {
    path: '/register',
    name: 'Register',
    component: Register
  },
  {
    path: '/usertable',
    name: 'Usertable',
    component: Usertable
  },
  {
    path: '/userinfotable',
    name: 'UserInfotable',
    component: UserInfotable
  },
  {
    path: '/basicinfo',
    name: 'BasicInfo',
    component: BasicInfo
  },
  {
    path: '/passwordchange',
    name: 'PasswordChange',
    component: PasswordChange
  },
  {
    path: '/insertticket',
    name: 'InsertTicket',
    component: InsertTicket
  },
  {
    path: '/newincident',
    name: 'NewIncident',
    component: NewIncident
  },
  {
    path: '/newrequest',
    name: 'NewRequest',
    component: NewRequest
  },
  {
    path: '/incidentoverview',
    name: 'IncidentOverview',
    component: IncidentOverview,
    //meta: { keepAlive: true } // 需要缓存

  },
  {
    path: '/incidentopenedbyme',
    name: 'IncidentOpenedByMe',
    component: IncidentOpenedByMe
  },
  {
    path: '/incidentdetail/:incId', // 修改为 :incId
    name: 'IncidentDetail',
    component: IncidentDetail,
    //meta: { keepAlive: true }, // 需要缓存

    props:true
  },
  {
    path: '/requestoverview',
    name: 'RequestOverview',
    component: RequestOverview
  },
  {
    path: '/requestdetail/:reqId', // 修改为 :reqId
    name: 'RequestDetail',
    component: RequestDetail
  },

  {
    path: '/requestdetailforatome/:reqId', // 修改为 :reqId
    name: 'RequestDetailforAtoMe',
    component: RequestDetailforAtoMe,
    props:true
  },
  {
    path: '/requestdetailforobyme/:reqId', // 修改为 :reqId
    name: 'RequestDetailforObyMe',
    component: RequestDetailforObyMe,
    props:true
  },
  {
    path: '/requestdetailforpickup/:reqId', // 修改为 :reqId
    name: 'RequestDetailforPickUp',
    component: RequestDetailforPickUp,
    props:true
  },
  {
    path: '/incidentassignedtome',
    name: 'IncidentAssignedToMe',
    component: IncidentAssignedToMe
  },
  {
    path: '/requestopenedbyme',
    name: 'RequestOpenedByMe',
    component: RequestOpenedByMe
  },
  {
    path: '/requestassignedtome',
    name: 'RequestAssignedToMe',
    component: RequestAssignedToMe
  },
  {
    path: '/incidentpickup',
    name: 'IncidentPickUp',
    component: IncidentPickUp
  },
  {
    path: '/requestpickup',
    name: 'RequestPickUp',
    component: RequestPickUp
  },
  {
    path: '/incidentcommenttable', 
    name: 'IncidentCommentTable',
    component: IncidentCommentTable
  },
  {
    path: '/requestcommenttable', 
    name: 'RequestCommentTable',
    component: RequestCommentTable
  },
  {
    path: '/incidentreportview', 
    name: 'IncidentReportView',
    component: IncidentReportView
  },
  {
    path: '/requestreportview', 
    name: 'RequestReportView',
    component: RequestReportView
  },
  {
    path: '/incidentdecisiontree', 
    name: 'IncidentDecisionTree',
    component: IncidentDecisionTree,
     //meta: { keepAlive: true } // 需要缓存
  },
  {
    path: '/incidentdetailfortree/:incId', // 修改为 :incId
    name: 'IncidentDetailfortree',
    component: IncidentDetailfortree,
    props:true,
     //meta: { keepAlive: true }, // 需要缓存
  },
  {
    path: '/incidentdetailforatome/:incId', // 修改为 :incId
    name: 'IncidentDetailforAtoMe',
    component: IncidentDetailforAtoMe,
  },
  {
    path: '/incidentdetailforobyme/:incId', // 修改为 :incId
    name: 'IncidentDetailforObyMe',
    component: IncidentDetailforObyMe,
  },
  {
    path: '/incidentdetailforpickup/:incId', // 修改为 :incId
    name: 'IncidentDetailforPickUp',
    component: IncidentDetailforPickUp,
  },


];

const router = createRouter({
  history: createWebHistory(),
  routes
});

export default router;